home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.UserControl ctlBreakout
- BorderStyle = 1 'Fixed Single
- ClientHeight = 7380
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 9600
- KeyPreview = -1 'True
- ScaleHeight = 492
- ScaleMode = 3 'Pixel
- ScaleWidth = 640
- ToolboxBitmap = "ctlBreakout.ctx":0000
- Begin VB.CommandButton cmdBall
- Caption = "Shoot Ball"
- Height = 495
- Left = 4440
- TabIndex = 9
- Top = 6720
- Width = 1095
- End
- Begin VB.CommandButton cmdNewGame
- Caption = "New Game"
- Height = 495
- Left = 8040
- TabIndex = 8
- Top = 6720
- Width = 1095
- End
- Begin VB.ComboBox cmbLevel
- Height = 315
- ItemData = "ctlBreakout.ctx":0312
- Left = 360
- List = "ctlBreakout.ctx":0314
- Style = 2 'Dropdown List
- TabIndex = 7
- Top = 6720
- Width = 1455
- End
- Begin VB.CommandButton cmdHighScore
- Caption = "HighScore"
- Height = 375
- Left = 1920
- TabIndex = 6
- Top = 6720
- Width = 975
- End
- Begin VB.PictureBox picBlack
- Appearance = 0 'Flat
- AutoRedraw = -1 'True
- BackColor = &H00000000&
- FillStyle = 0 'Solid
- ForeColor = &H80000008&
- Height = 375
- Left = 360
- ScaleHeight = 345
- ScaleWidth = 1245
- TabIndex = 3
- Top = 5880
- Width = 1275
- Visible = 0 'False
- End
- Begin VB.PictureBox picField
- Appearance = 0 'Flat
- BackColor = &H00000000&
- ClipControls = 0 'False
- ForeColor = &H80000008&
- Height = 5295
- Left = 240
- ScaleHeight = 351
- ScaleMode = 3 'Pixel
- ScaleWidth = 603
- TabIndex = 0
- Top = 480
- Width = 9075
- Begin VB.PictureBox picPaddle
- Appearance = 0 'Flat
- AutoRedraw = -1 'True
- AutoSize = -1 'True
- BackColor = &H00000000&
- BorderStyle = 0 'None
- FillColor = &H00FFFFFF&
- FillStyle = 0 'Solid
- ForeColor = &H00FFFFFF&
- Height = 90
- Left = 4440
- Picture = "ctlBreakout.ctx":0316
- ScaleHeight = 6
- ScaleMode = 3 'Pixel
- ScaleWidth = 30
- TabIndex = 2
- Top = 5040
- Width = 450
- End
- Begin VB.PictureBox picBall
- Appearance = 0 'Flat
- AutoRedraw = -1 'True
- AutoSize = -1 'True
- BackColor = &H80000005&
- BorderStyle = 0 'None
- ForeColor = &H80000008&
- Height = 90
- Left = 3960
- Picture = "ctlBreakout.ctx":037F
- ScaleHeight = 6
- ScaleMode = 3 'Pixel
- ScaleWidth = 6
- TabIndex = 1
- Top = 4560
- Width = 90
- Visible = 0 'False
- End
- Begin VB.Image imgBlock
- Appearance = 0 'Flat
- DragMode = 1 'Automatic
- Enabled = 0 'False
- Height = 180
- Index = 0
- Left = 240
- OLEDragMode = 1 'Automatic
- OLEDropMode = 2 'Automatic
- Picture = "ctlBreakout.ctx":03E1
- Top = 360
- Width = 360
- Visible = 0 'False
- End
- End
- Begin VB.Label lblScore
- Caption = "Score: "
- Height = 255
- Left = 3840
- TabIndex = 5
- Top = 120
- Width = 1455
- End
- Begin VB.Label lblBallsLeft
- Caption = "Balls left: "
- Height = 255
- Left = 8040
- TabIndex = 4
- Top = 120
- Width = 1455
- End
- Begin VB.Image imgBlockColor
- Appearance = 0 'Flat
- DragMode = 1 'Automatic
- Enabled = 0 'False
- Height = 180
- Index = 0
- Left = 1920
- OLEDragMode = 1 'Automatic
- OLEDropMode = 2 'Automatic
- Picture = "ctlBreakout.ctx":0459
- Top = 5880
- Width = 360
- Visible = 0 'False
- End
- Begin VB.Image imgBlockColor
- Appearance = 0 'Flat
- DragMode = 1 'Automatic
- Enabled = 0 'False
- Height = 180
- Index = 1
- Left = 2400
- OLEDragMode = 1 'Automatic
- OLEDropMode = 2 'Automatic
- Picture = "ctlBreakout.ctx":04D1
- Top = 5880
- Width = 360
- Visible = 0 'False
- End
- Begin VB.Image imgBlockColor
- Appearance = 0 'Flat
- DragMode = 1 'Automatic
- Enabled = 0 'False
- Height = 180
- Index = 2
- Left = 3000
- OLEDragMode = 1 'Automatic
- OLEDropMode = 2 'Automatic
- Picture = "ctlBreakout.ctx":0549
- Top = 5880
- Width = 360
- Visible = 0 'False
- End
- End
- Attribute VB_Name = "ctlBreakout"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- '-------------------------------------------------------------------------
- 'Author: Anders Fransson
- 'Email: anders.fransson@home.se
- 'Internet: http://hem1.passagen.se/fylke
- 'Date: 98-07-10
- '-------------------------------------------------------------------------
-
- Option Explicit
-
- Private m_iXstep As Integer 'Ball step in x-dir
- Private m_iYstep As Integer 'Ball step in y-dir
- Private m_iKeyCode As Integer 'Left key = -1, Right Key = 1, Key up = 0
- Private m_iRows As Integer 'No rows with blocks
- Private m_iBlockIndex As Integer 'Index of block (overlapped with ball)
- Private m_vLevel As Variant 'String array with levels
- Private m_iLevel As Integer 'Level (0-2)
- Private m_lScore As Long 'Total score
- Private m_lLevelScore As Long 'Score at current level
- Private m_iNoBallsLeft As Integer
-
- 'Sizes
- Private m_iBallLeft As Integer
- Private m_iBallTop As Integer
- Private m_iBallDiameter As Integer
- Private m_iBlockLeft As Integer
- Private m_iBlockTop As Integer
- Private m_iBlockHeight As Integer
- Private m_iBlockWidth As Integer
- Private m_iPaddleLeft As Integer
- Private m_iPaddleTop As Integer
- Private m_iPaddleHeight As Integer
- Private m_iPaddleWidth As Integer
- Private m_iFieldLeft As Integer
- Private m_iFieldWidth As Integer
-
- 'Field size (ball diameter as unit)
- Private Const X_SIZE As Integer = 104
- Private Const Y_SIZE As Integer = 69
-
- 'Blocks
- Private Const MAX_ROWS As Integer = 24
- Private Const EMPTY_ROWS As Integer = 3
- Private Const BLOCKS_IN_ROW As Integer = 26
-
- 'Ball
- Private Const MAX_BALLS As Integer = 5
- Private Const TOP_LEFT As Integer = 0
- Private Const TOP_RIGHT As Integer = 1
- Private Const BOTTOM_LEFT As Integer = 2
- Private Const BOTTOM_RIGHT As Integer = 3
-
- 'Key constants
- Private Const KEY_LEFT As Integer = -1
- Private Const KEY_RIGHT As Integer = 1
-
- 'Paddle
- Private Const PADDLE_STEP As Integer = 4
-
- 'Level (BallTimer interval)
- Private Const LEVEL_EASY As Integer = 16
- Private Const LEVEL_MEDIUM As Integer = 8
- Private Const LEVEL_HARD As Integer = 4
-
- 'Text constants
- Private Const TEXT_HIGH_SCORE As String = "High Score"
- Private Const TEXT_INPUT_PLAYER As String = "Write your name!"
- Private Const TEXT_LEVEL As String = "Level"
- Private Const TEXT_PLAYER As String = "Player"
- Private Const TEXT_SCORE As String = "Score"
- Private Const TEXT_EASY As String = "Easy"
- Private Const TEXT_MEDIUM As String = "Medium"
- Private Const TEXT_HARD As String = "Hard"
- Private Const TEXT_BALLS_LEFT As String = "Balls left"
-
- 'Registry constants
- Private Const TEXT_ANDERS_GAMES As String = "Anders Franssons Made In Home Games"
- Private Const TEXT_REGISTRY_PADDLE As String = "Breakout"
- Private Const TEXT_REGISTRY_PLAYER As String = "Player"
-
- Private WithEvents BallTimer As ccrpTimer
- Attribute BallTimer.VB_VarHelpID = -1
- Private WithEvents PaddleTimer As ccrpTimer
- Attribute PaddleTimer.VB_VarHelpID = -1
-
- Private Sub UserControl_Show()
-
- Dim i%
-
- 'Create timer objects
- Set BallTimer = New ccrpTimer
- Set PaddleTimer = New ccrpTimer
-
- 'Ball-timer properties
- With BallTimer
- .EventType = TimerPeriodic
- .Stats.Frequency = 2
- End With
-
- 'Paddle-timer properties
- With PaddleTimer
- .EventType = TimerPeriodic
- .Stats.Frequency = 2
- .Enabled = True
- End With
-
- 'Load blocks
- For i = 1 To BLOCKS_IN_ROW * MAX_ROWS + 1
- Load imgBlock(i)
- Next
-
- 'Set size variables (use variables instead of properties = faster)
- m_iBallDiameter = picBall.Width
- m_iBlockHeight = imgBlock(0).Height
- m_iBlockWidth = imgBlock(0).Width
- m_iPaddleHeight = picPaddle.Height
- m_iPaddleWidth = picPaddle.Width
- m_iPaddleTop = Y_SIZE * m_iBallDiameter - 2 * m_iPaddleHeight
-
- 'Start values
- m_iFieldLeft = 4
- m_iFieldWidth = X_SIZE * m_iBallDiameter + 2
- picField.Move m_iFieldLeft, 20, m_iFieldWidth, Y_SIZE * m_iBallDiameter + 4
- m_vLevel = Array(TEXT_EASY, TEXT_MEDIUM, TEXT_HARD)
- lblScore.Move m_iFieldWidth / 2 - 30, 5
- lblBallsLeft.Move m_iFieldWidth - 55, 5
-
- 'Add combo box items
- cmbLevel.AddItem TEXT_EASY
- cmbLevel.AddItem TEXT_MEDIUM
- cmbLevel.AddItem TEXT_HARD
-
- 'Select medium level
- cmbLevel.ListIndex = 1
-
- 'Initialize random number generator
- Randomize
-
- SetFocus
-
- NewGame
-
- End Sub
-
- Private Sub UserControl_KeyDown(KeyCode As Integer, Shift As Integer)
-
- 'Update paddle direction
- Select Case KeyCode
- Case vbKeyLeft, vbKeyNumpad4: m_iKeyCode = KEY_LEFT
- Case vbKeyRight, vbKeyNumpad6: m_iKeyCode = KEY_RIGHT
- Case vbKeyReturn: If Not BallTimer.Enabled Then NewBall
- End Select
-
- End Sub
-
- Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
-
- 'Stop paddle
- Select Case KeyCode
- Case vbKeyLeft, vbKeyNumpad4: If m_iKeyCode = KEY_LEFT Then m_iKeyCode = 0
- Case vbKeyRight, vbKeyNumpad6: If m_iKeyCode = KEY_RIGHT Then m_iKeyCode = 0
- End Select
-
- End Sub
-
- Private Sub UserControl_Terminate()
-
- BallTimer.Enabled = False
- PaddleTimer.Enabled = False
- Set BallTimer = Nothing
- Set PaddleTimer = Nothing
-
- End Sub
-
- Private Sub cmdHighScore_Click()
-
- Dim i%
- Dim sHighScore As String, sTab As String
-
- sHighScore = TEXT_LEVEL & vbTab & vbTab & TEXT_SCORE & vbTab & vbTab & _
- TEXT_PLAYER & vbNewLine & vbNewLine
-
- 'Get high score from registry
- For i = 0 To 2
- sTab = vbTab
- If Len(m_vLevel(i)) < 10 Then sTab = vbTab & vbTab
- sHighScore = sHighScore & m_vLevel(i) & sTab & _
- GetSetting(TEXT_ANDERS_GAMES, TEXT_REGISTRY_PADDLE, i, "-") & vbTab & vbTab & _
- GetSetting(TEXT_ANDERS_GAMES, TEXT_REGISTRY_PADDLE, TEXT_REGISTRY_PLAYER & i, "-") & _
- vbNewLine
- Next
-
- 'Show high score in msgbox
- MsgBox sHighScore, vbOKOnly, TEXT_HIGH_SCORE
-
- End Sub
-
- Private Sub cmdBall_Click()
- NewBall
- End Sub
-
- Private Sub cmbLevel_Click()
-
- m_iLevel = cmbLevel.ListIndex
-
- Select Case cmbLevel.ListIndex
- Case 0
- BallTimer.Interval = LEVEL_EASY
- PaddleTimer.Interval = LEVEL_EASY - 4
- Case 1
- BallTimer.Interval = LEVEL_MEDIUM
- PaddleTimer.Interval = LEVEL_MEDIUM
- Case 2
- BallTimer.Interval = LEVEL_HARD
- PaddleTimer.Interval = LEVEL_HARD
- End Select
-
- lblScore = m_vLevel(m_iLevel) & ": " & m_lScore
-
- End Sub
-
- Private Sub cmdNewGame_Click()
- NewGame
- End Sub
-
- Private Sub PaddleTimer_Timer(ByVal Milliseconds As Long)
-
- 'Update paddle position
- If (m_iPaddleLeft > m_iFieldLeft And m_iKeyCode = KEY_LEFT) Or _
- (m_iPaddleLeft + m_iPaddleWidth < m_iFieldLeft + m_iFieldWidth - 5 And _
- m_iKeyCode = KEY_RIGHT) Then
- m_iPaddleLeft = m_iPaddleLeft + m_iKeyCode * PADDLE_STEP
- PlacePaddle m_iPaddleLeft - 2, m_iPaddleTop
- End If
-
- 'Update the paddle if the ball has hit it
- If (m_iBallTop + 2 * m_iBallDiameter >= m_iPaddleTop) Then picPaddle.Refresh
-
- End Sub
-
- Private Sub BallTimer_Timer(ByVal Milliseconds As Long)
-
- Dim i%
-
- 'Update ball position
- m_iBallLeft = m_iBallLeft + m_iXstep
- m_iBallTop = m_iBallTop + m_iYstep
-
- 'Change the ball direction if a wall is hit
- If m_iBallLeft <= 0 Then
- m_iXstep = Abs(m_iXstep)
- PlaySound App.Path & "\WallHit.wav"
- ElseIf m_iBallLeft + m_iBallDiameter >= m_iFieldWidth Then
- m_iXstep = -Abs(m_iXstep)
- PlaySound App.Path & "\WallHit.wav"
- ElseIf m_iBallTop <= 0 Then
- m_iYstep = Abs(m_iYstep)
- PlaySound App.Path & "\WallHit.wav"
- End If
-
- 'Check if the paddle is hit
- If (m_iBallTop + m_iBallDiameter >= picPaddle.Top) Then
- 'Outside paddle
- If Not ((m_iBallLeft + m_iBallDiameter > picPaddle.Left - Abs(m_iXstep)) And _
- (m_iBallLeft < picPaddle.Left + m_iPaddleWidth + Abs(m_iXstep))) Then
- BallTimer.Enabled = False
- RemoveBall picBall.Left, picBall.Top
- m_iNoBallsLeft = m_iNoBallsLeft - 1
- m_iKeyCode = 0
- lblBallsLeft = TEXT_BALLS_LEFT & ": " & m_iNoBallsLeft
- picBall.Refresh
- PlaySound App.Path & "\PaddleMiss.wav"
- cmdBall.Enabled = True
- If m_iNoBallsLeft = 0 Then
- 'If high score
- If m_lScore > GetSetting(TEXT_ANDERS_GAMES, TEXT_REGISTRY_PADDLE, m_iLevel, 0) Then
- SaveSetting TEXT_ANDERS_GAMES, TEXT_REGISTRY_PADDLE, m_iLevel, m_lScore
- SaveSetting TEXT_ANDERS_GAMES, TEXT_REGISTRY_PADDLE, TEXT_REGISTRY_PLAYER & m_iLevel, _
- Left(Trim(InputBox(TEXT_INPUT_PLAYER, TEXT_HIGH_SCORE)), 20)
- End If
- cmdBall.Enabled = False
- End If
- Exit Sub
- 'At the very right edge
- ElseIf (m_iBallLeft + m_iBallDiameter / 2 >= picPaddle.Left + m_iPaddleWidth) Then
- If m_iXstep < 4 Then
- m_iXstep = Abs(m_iXstep) + 1
- Else
- m_iXstep = Abs(m_iXstep)
- End If
- 'At the very left edge
- ElseIf (m_iBallLeft + m_iBallDiameter / 2 <= picPaddle.Left) Then
- If m_iXstep > -4 Then
- m_iXstep = -Abs(m_iXstep) - 1
- Else
- m_iXstep = -Abs(m_iXstep)
- End If
- 'At the right edge
- ElseIf (m_iBallLeft + m_iBallDiameter >= picPaddle.Left + m_iPaddleWidth) Then
- m_iXstep = Abs(m_iXstep)
- 'At the left edge
- ElseIf (m_iBallLeft <= picPaddle.Left) Then
- m_iXstep = -Abs(m_iXstep)
- End If
- PlaySound App.Path & "\PaddleHit.wav"
- m_iYstep = -5 + Abs(m_iXstep)
- End If
-
- 'Check the ball overlap any block (loop the corners of the ball)
- For i = TOP_LEFT To BOTTOM_RIGHT
-
- 'Calculate index for block at selected ball position
- If i = TOP_LEFT Then
- m_iBlockIndex = Int(m_iBallTop / m_iBlockHeight) * BLOCKS_IN_ROW + _
- Int(m_iBallLeft / m_iBlockWidth) - BLOCKS_IN_ROW * EMPTY_ROWS
- ElseIf i = TOP_RIGHT Then
- m_iBlockIndex = Int(m_iBallTop / m_iBlockHeight) * BLOCKS_IN_ROW + _
- Int((m_iBallLeft + m_iBallDiameter) / m_iBlockWidth) - BLOCKS_IN_ROW * EMPTY_ROWS
- ElseIf i = BOTTOM_LEFT Then
- m_iBlockIndex = Int((m_iBallTop + m_iBallDiameter) / m_iBlockHeight) * BLOCKS_IN_ROW + _
- Int(m_iBallLeft / m_iBlockWidth) - BLOCKS_IN_ROW * EMPTY_ROWS
- ElseIf i = BOTTOM_RIGHT Then
- m_iBlockIndex = Int((m_iBallTop + m_iBallDiameter) / m_iBlockHeight) * BLOCKS_IN_ROW + _
- Int((m_iBallLeft + m_iBallDiameter) / m_iBlockWidth) - BLOCKS_IN_ROW * EMPTY_ROWS
- End If
-
- 'Exit if not valid index
- If (m_iBlockIndex < 0) Or (m_iBlockIndex > BLOCKS_IN_ROW * m_iRows) Then _
- m_iBlockIndex = BLOCKS_IN_ROW * MAX_ROWS + 1
-
- 'Set block variables
- m_iBlockLeft = imgBlock(m_iBlockIndex).Left
- m_iBlockTop = imgBlock(m_iBlockIndex).Top
-
- 'If block is hit
- If imgBlock(m_iBlockIndex).Visible And Abs(m_iBallLeft - m_iBlockLeft) <= m_iBlockWidth Then
- 'from above
- If m_iYstep > 0 Then
- If m_iBallTop >= m_iBlockTop - 2 Then
- m_iXstep = -m_iXstep
- Else
- m_iYstep = -m_iYstep
- End If
- 'from below
- Else
- If m_iBallTop + m_iBallDiameter <= m_iBlockTop + m_iBlockHeight + 2 Then
- m_iXstep = -m_iXstep
- Else
- m_iYstep = -m_iYstep
- End If
- End If
- imgBlock(m_iBlockIndex).Visible = False
- m_lScore = m_lScore + m_iRows - m_iBlockIndex \ BLOCKS_IN_ROW
- m_lLevelScore = m_lLevelScore + m_iRows - m_iBlockIndex \ BLOCKS_IN_ROW
- lblScore = m_vLevel(m_iLevel) & ": " & m_lScore
- PlaySound App.Path & "\BlockHit.wav"
- If m_lLevelScore = BLOCKS_IN_ROW * m_iRows * (m_iRows + 1) / 2 Then NewLevel
- Exit Sub
- End If
-
- Next
-
- 'Place the ball to the new position
- PlaceBall m_iBallLeft, m_iBallTop
-
- End Sub
-
- Private Sub NewBall()
-
- Dim iSign%
-
- 'Disable controls
- cmdBall.Enabled = False
- cmbLevel.Enabled = False
- cmdHighScore.Enabled = False
-
- 'Exit if there are no balls left
- If m_iNoBallsLeft = 0 Then Exit Sub
-
- 'Place ball in the middle of the paddle
- m_iBallLeft = m_iPaddleLeft + m_iPaddleWidth / 2 - m_iBallDiameter / 2
- m_iBallTop = picPaddle.Top - m_iBallDiameter - 2
- PlaceBall m_iBallLeft, m_iBallTop
-
- 'Select random ball direction (-2 to 2)
- iSign = Sgn((2 * Rnd) - 1)
- If iSign = 0 Then iSign = 1
- m_iXstep = iSign * Int((2 * Rnd) + 1)
- m_iYstep = -5 + Abs(m_iXstep)
-
- 'Start moving the ball
- BallTimer.Enabled = True
-
- End Sub
-
- Private Sub NewLevel()
-
- Dim i%, j%
-
- m_lLevelScore = 0
-
- 'Stop moving the ball
- BallTimer.Enabled = False
-
- 'Change ball position to the middle of the paddle
- m_iBallLeft = m_iPaddleLeft + m_iPaddleWidth / 2 - m_iBallDiameter / 2
- m_iBallTop = picPaddle.Top - m_iBallDiameter - 2
- PlaceBall m_iBallLeft, m_iBallTop
- RemoveBall picBall.Left, picBall.Top
-
- 'Place block
- If m_iRows < MAX_ROWS Then m_iRows = m_iRows + 6
- For i = 0 To m_iRows - 1
- For j = 0 To BLOCKS_IN_ROW - 1
- imgBlock((i * BLOCKS_IN_ROW) + j).Move _
- j * m_iBlockWidth, (i + EMPTY_ROWS) * m_iBlockHeight
- If i < m_iRows - 2 Then _
- imgBlock((i * BLOCKS_IN_ROW) + j).Picture = imgBlockColor(i \ 2 Mod 3).Picture
- imgBlock((i * BLOCKS_IN_ROW) + j).Visible = True
- Next
- Next
-
- End Sub
-
- Private Sub NewGame()
-
- 'Place paddle in the middle
- m_iPaddleLeft = Int(X_SIZE / 2) * m_iBallDiameter - 1
- picPaddle.Move m_iPaddleLeft, m_iPaddleTop
- PlacePaddle picPaddle.Left, picPaddle.Top
- RemoveBall picBall.Left, picBall.Top
-
- 'Start values
- m_iRows = 0
- m_lScore = 0
- m_iNoBallsLeft = MAX_BALLS
- lblScore = m_vLevel(m_iLevel) & ": " & m_lScore
- lblBallsLeft = TEXT_BALLS_LEFT & ": " & m_iNoBallsLeft
-
- 'Enable controls
- cmbLevel.Enabled = True
- cmdBall.Enabled = True
- cmdHighScore.Enabled = True
- NewLevel
-
- End Sub
-
- Private Function PlaceBall(ByVal lLeft As Long, ByVal lTop As Long) As Long
-
- 'Place black picture over ball
- BitBlt picField.hDC, picBall.Left, picBall.Top, m_iBallDiameter, m_iBallDiameter, _
- picBlack.hDC, 0, 0, SRCCOPY
-
- 'Update ball position
- picBall.Move lLeft, lTop
-
- 'Write ball
- PlaceBall = BitBlt(picField.hDC, lLeft, lTop, m_iBallDiameter, m_iBallDiameter, _
- picBall.hDC, 0, 0, SRCCOPY)
-
- End Function
-
- Private Function RemoveBall(ByVal lLeft As Long, ByVal lTop As Long) As Long
- RemoveBall = BitBlt(picField.hDC, lLeft, lTop, m_iBallDiameter, m_iBallDiameter, _
- picBlack.hDC, 0, 0, SRCCOPY)
- End Function
-
- Private Function PlacePaddle(ByVal lLeft As Long, ByVal lTop As Long) As Long
-
- 'Place black picture over paddle
- BitBlt picField.hDC, picPaddle.Left, picPaddle.Top, m_iPaddleWidth, m_iPaddleHeight, _
- picBlack.hDC, 0, 0, SRCCOPY
-
- 'Update paddle position
- picPaddle.Move lLeft, lTop
-
- 'Write paddle
- PlacePaddle = BitBlt(picField.hDC, lLeft, lTop, m_iPaddleWidth, m_iPaddleHeight, _
- picPaddle.hDC, 0, 0, SRCCOPY)
-
- End Function
-
- Private Sub PlaySound(strSound As String)
- sndPlaySound strSound, SND_ASYNC Or SND_NODEFAULT
- End Sub
-